package com.preguicoso.client.login;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.InlineLabel;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import com.preguicoso.client.RegistroToken;
import com.preguicoso.client.telaInicial.lightBox;
import com.preguicoso.shared.RegistroErros;
import com.preguicoso.shared.entities.UsuarioBean;
import com.google.gwt.user.client.ui.PasswordTextBox;

public class LoginUI extends Composite {

	private static LoginUIUiBinder uiBinder = GWT.create(LoginUIUiBinder.class);

	private final LoginServiceAsync loginService = GWT
			.create(LoginService.class);

	interface LoginUIUiBinder extends UiBinder<Widget, LoginUI> {
	}

	@UiField
	TextBox email;
	@UiField PasswordTextBox senha;
	@UiField Button botao;

	public static LoginUI lu;

	public static LoginUI getInstance() {
		return lu;
	}

	public LoginUI() {
		this.initWidget(uiBinder.createAndBindUi(this));
	}

	@UiHandler("botao")
	void onBotaoClick(ClickEvent event) {
		Login.getInstance().Logar(email.getText(), senha.getText());
	}
}